package com.dragon.cloud.zconf.client;


public interface ZConfNode {

    /**
     * get the config node app id.
     *
     * @return app id
     */
    public String getAppId();

    /**
     * get the config node key.
     *
     * @return key
     */
    public String getKey();

    /**
     * get the config node path.
     *
     * @return path
     */
    public String getPath();

    /**
     * get the config node value.
     * 注意：第一次取值时有可能返回空串（发生场景：到zk的连接没有建立完成且本地文件没有缓存该配置），发生概率很小，业务做好兼容
     *
     * @return value
     */
    public String getValue();

    /**
     *
     * get the config node value.
     * 
     * @param value
     * @return boolean
     */
    public boolean setValue(String value);

    /**
     * after sync , you can get the newest config value.
     */
    public void sync();

    /**
     * 添加自定义监听器
     * monitor the data change.
     */
    public void monitor(ZConfNodeListener listener);

    /**
     * destroy the config node.
     */
    public void destroy();
}
